package com.example.ass.mapper;




import com.example.ass.pojo.Category;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface CategoryMapper {
    @Select("SELECT * FROM category")
    List<Category> findAll();

    @Select("SELECT * FROM category WHERE id = #{id}")
    Category findById(Integer id);

    @Insert("INSERT INTO category (category_name, category_alias, create_user, create_time, update_time) " +
            "VALUES (#{categoryName}, #{categoryAlias}, #{createUser}, #{createTime}, #{updateTime})")
    void insert(Category category);

    @Update("UPDATE category SET category_name = #{categoryName}, category_alias = #{categoryAlias}, " +
            "create_user = #{createUser}, create_time = #{createTime}, update_time = #{updateTime} " +
            "WHERE id = #{id}")
    void update(Category category);

    @Delete("DELETE FROM category WHERE id = #{id}")
    void delete(Integer id);
}